<template>
<!-- <div class="goods-list-copy"> -->
  <div class="goods-item-copy" @click="routerClick">
    <img :src="goodItem.image" alt="" @load="imgLoad">
    <div class="goods-info-copy">
      <p >{{goodItem.title}}</p>
      <!-- <span class="price">{{goodItem.currency_symbol + goodItem.price_rmb}}</span> -->
      <span class="price-copy">{{'￥'+goodItem.price}}</span><span>--收藏次数:</span>
      <span class="collect-copy">{{goodItem.cfav}}</span>
    </div>
    <!-- <h2>{{goodItem}}</h2> -->
  </div>
<!-- </div> -->
</template>

<script>
  export default {
    name: "GoodListItemCopy",
    props:{
      goodItem: {
        type: Object,
        default() {
          return {}
        }
      }
    },
    methods: {
      imgLoad() {
        this.$bus.$emit('imgLoad')
        // //if的意思是发送不同的事件，比如imgLoad2
        // if (this.$route.path.indexOf('/home')) {
        //   this.$bus.$emit('imgLoad')
        // } else if (this.$route.path.indexOf('/detail')) {
        //   this.$bus.$emit('imgLoad2')
        // }
      },
      routerClick() {
        this.$router.push('/detail/' + this.goodItem.iid)
      }
    }
  }
</script>

<style>
  .goods-item-copy {
    padding-bottom: 40px;
    position: relative;

    width: 48%;
  }

  .goods-item-copy img {
    width: 100%;
    border-radius: 5px;
    /* border:2.1px solid var(--color-tint); */
  }

  .goods-info-copy {
    font-size: 12px;
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    overflow: hidden;
    text-align: center;
  }

  .goods-info-copy p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
  }

  .goods-info-copy .price {
    color: var(--color-high-text);
    margin-right: 20px;
  }

  .goods-info-copy .collect {
    position: relative;
  }

  .goods-info-copy .collect::before {
    content: '';
    position: absolute;
    left: -17px;
    top: 1px;
    width: 14px;
    height: 14px;
    background: url("~assets/images/common/collect.svg") 0 0/14px 14px;
  }

</style>
